package controller;

import java.awt.Color;

import view.AdminPanel;
import view.CenterPanel;
import view.MainFrame;

/**
 * ColorChanger changes the colors of every component in the front-end, when the users request
 * a change, by either using the JSlider or changing skin in settings.
 * @author Christian
 *
 */
public class ColorChanger extends SlideHandler {

	private MainFrame frame;
	
/**
 * Constructor declares object of its superclass
 * @param frame
 */
public ColorChanger(MainFrame frame) {
		super(frame);
		this.frame = frame;
		// TODO Auto-generated constructor stub
	}

public void colorChange(Color bgColor)
{
	
	CenterPanel centerPanel= frame.getCenterPanel();
	AdminPanel adminPanel = frame.getAdminPanel();
	
	centerPanel.getDeposit().getRdbtnCoffeeMug().setBackground(bgColor);
	 centerPanel.getDeposit().getRdbtnCustom().setBackground(bgColor);
	 centerPanel.getDeposit().getRdbtnGoesGreenCoffee().setBackground(bgColor);
	 centerPanel.getDeposit().getRdbtnGoesGreenFixie().setBackground(bgColor);
	 centerPanel.getDeposit().getRdbtnLargeCoffee().setBackground(bgColor);
	 centerPanel.getWithdrawal().getRdbtnAmbasssador().setBackground(bgColor);
	 centerPanel.getWithdrawal().getRdbtnBike().setBackground(bgColor);
	 centerPanel.getWithdrawal().getRdbtnCustom().setBackground(bgColor);
	 centerPanel.getWithdrawal().getRdbtnProducts().setBackground(bgColor);
	 centerPanel.getWithdrawal().getRdbtnStairway().setBackground(bgColor);
	 centerPanel.getAbout().getSlider().setBackground(bgColor); 
	 centerPanel.getCreateAccount().getRdbtnCreateAccount().setBackground(bgColor);
	 centerPanel.getCreateAccount().getRdbtnDeleteAccount().setBackground(bgColor);
	
	 adminPanel.getAdminEditUser().getScrollPane().getViewport().setBackground(bgColor);
	 adminPanel.getAdminStatistics().getRdbtnAllAccountBalances().setBackground(bgColor);
	 adminPanel.getAdminStatistics().getRdbtnSpecificUsersAccount().setBackground(bgColor);
	 adminPanel.getAdminStatistics().getRdbtnUsersPasswordLength().setBackground(bgColor);
	 adminPanel.getAdminStatistics().getRdbtnYourOwnTransactions().setBackground(bgColor);
	 
	adminPanel.getAdminEditUser().setTableColors(bgColor);
	centerPanel.getAbout().setBackground(bgColor);
	centerPanel.getBalance().setBackground(bgColor);
	centerPanel.getDeposit().setBackground(bgColor); 
	centerPanel.getWithdrawal().setBackground(bgColor); 
	centerPanel.getTransfer().setBackground(bgColor);
	centerPanel.getLeaderboard().setBackground(bgColor);
	centerPanel.getLeaderboard().setTableColors(bgColor);
	centerPanel.getLeaderboard().getScrollPane().getViewport().setBackground(bgColor);

	frame.getLogin().setBackground(bgColor);
	centerPanel.getBalance().setBackground(bgColor);
	centerPanel.getBalance().setTableColors(bgColor);
	centerPanel.getBalance().getScrollPane().getViewport().setBackground(bgColor);
	

	centerPanel.getStatistics().setBackground(bgColor);
	centerPanel.getStatistics().setTableColors(bgColor);
	centerPanel.getStatistics().getScrollPane().getViewport().setBackground(bgColor);
	centerPanel.getCreateAccount().setBackground(bgColor);
	centerPanel.getCreateAccount().getListDeleteAccount().setBackground(bgColor);
	frame.getMenu().setBackground(bgColor);
	frame.getTotalAmount().setBackground(bgColor);
	frame.getLogin().setBackground(bgColor);
	
	adminPanel.getAdminCreateUser().setBackground(bgColor);
	adminPanel.getAdminDeleteUser().setBackground(bgColor);
	adminPanel.getAdminEditUser().setBackground(bgColor);
	adminPanel.getAdminEditUser().setTableColors(bgColor);
	adminPanel.getAdminLogin().setBackground(bgColor);
	adminPanel.getAdminMenu().setBackground(bgColor);
	adminPanel.getAdminStatistics().setBackground(bgColor);
	adminPanel.getAdminStatistics().getListUsers().setBackground(bgColor);
	
}
}
